# 图解算法练习4.1
def array_sum(arr):
    total = 0
    for x in arr:
        total += x
    return total

#递归求解数组之和
def r_sum(arr):
    if len(arr) == 1:
        return arr[0]
    else:
        arr[0] += arr.pop()
        return r_sum(arr)


list = list(range(1, 101))
print(r_sum(list))
